{% extends "base.html" %}
{% block ext_title %}
    <title>作者信息新增</title>
{% endblock %}
{% block content %}
    <div class="content-wrapper">
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-12">
                        <ol class="breadcrumb float-sm-left">
                            <li class="breadcrumb-item"><a href="{{url_for('author_list')}}">作者管理</a></li>
                            <li class="breadcrumb-item active">作者增加</li>
                        </ol>
                    </div>
                </div>
            </div>
        </section>
        <section class="content">
            <style>
                .flask-msg {
                    position: relative;
                    padding: 15px 15px;
                    margin-bottom: 10px;
                    border: 1px solid transparent;
                    color: #004085;
                    background-color: #cce5ff;
                    border-color: #b8daff;
                }
            </style>
            {% with messages = get_flashed_messages() %}
                {% if messages %}
                    <ul class="flash-messages">
                        {% for message in messages %}
                            <div class="flask-msg">{{ message }}</div>
                        {% endfor %}
                    </ul>
                {% endif %}
            {% endwith %}
            <div class="container-fluid">
                <div class="row">
                    <!-- left column -->
                    <div class="col-md-12">
                        <!-- Horizontal Form -->
                        <div class="card card-info">
                            <div class="card-header">
                                <h3 class="card-title">作者信息增加</h3>
                            </div>
                            <!-- /.card-header -->
                            <!-- form start -->
                            <form class="form-horizontal" method="post" novalidate>
                                {{ form.csrf_token }}
                                <div class="card-body">
                                    <div class="form-group row">
                                        <label for="inputtext" class="col-sm-2 col-form-label">作者姓名</label>

                                        <div class="col-sm-10">
                                            <!--<input type="text" class="form-control" id="name" name="name" placeholder="作者姓名">-->
                                            {{ form.name }}
                                            <span style="color:red">{{ form.name.errors[0] }}</span>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="inputtext" class="col-sm-2 col-form-label">年龄</label>
                                        <div class="col-sm-10">
                                            <!--<input type="number" class="form-control" id="age" name="age" placeholder="请输入年龄" value="1" step="1">-->
                                            {{ form.age }}
                                            <span style="color:red">{{ form.age.errors[0] }}</span>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="inputtext" class="col-sm-2 col-form-label">电话</label>
                                        <div class="col-sm-10">
                                            <!--<input type="number" minlength="11" maxlength="11" class="form-control" id="mobile" name="mobile" placeholder="电话">-->
                                            {{ form.mobile }}
                                            <span style="color:red">{{ form.mobile.errors[0] }}</span>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="inputtext" class="col-sm-2 col-form-label">地址</label>
                                        <div class="col-sm-10">
                                            <!--<input type="text" class="form-control" id="address" name="address" placeholder="地址">-->
                                            {{ form.address }}
                                            <span style="color:red">{{ form.address.errors[0] }}</span>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="inputtext" class="col-sm-2 col-form-label">简介</label>
                                        <div class="col-sm-10">
{#                                            <textarea class="form-control" rows="3" id="intro" name="intro"#}
{#                                                      placeholder="简介"></textarea>#}
                                            {{ form.intro }}
                                        </div>
                                    </div>
                                </div>
                                <!-- /.card-body -->
                                <div class="card-footer">
                                    <button type="submit" class="btn btn-info">保存</button>
                                    <script>    var authorListUrl = "{{ url_for('author_list') }}";
                                    </script>
                                    <button type="button" class="btn btn-default"
                                            onclick="javascript:window.location=authorListUrl">返回
                                    </button>
                                    <span style="color:red">{{ info }}</span>
                                </div>
                                <!-- /.card-footer -->
                            </form>
                        </div>
                        <!-- /.card -->
                    </div>

                    <!--/.col (right) -->
                </div>
                <!-- /.row -->
            </div><!-- /.container-fluid -->
        </section>
    </div>
{% endblock %}